package com.soft.small.host.controller;

import com.soft.small.host.entity.HostClient;
import com.soft.util.encrypt.MD5Utils;

public class HostClientController {

    /**
     *
     * @param hostClient
     */
    public void createHostClient(HostClient hostClient) {
        String clientId = "host-" + hostClient.getSn();
        Long time = System.currentTimeMillis() / 1000;
        String username = hostClient.getAppKey() + "|" + clientId + "|host|" + time;
        String password = MD5Utils.MD5Encoding(username + hostClient.getAppSecret(), "");

        hostClient.setClientId(clientId);
        hostClient.setUsername(username);
        hostClient.setPassword(password);
    }
}
